package com.example.uidemo;

import androidx.appcompat.app.AppCompatActivity;


import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    int mark = 0;
    LinearLayout ll;
    TextView name;
    TextView jieshao;
    ImageView photo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ll = findViewById(R.id.ll);
        name = findViewById(R.id.name);
        jieshao = findViewById(R.id.jieshao);
        photo = findViewById(R.id.photo);

        name.setText("詹炳武");
        jieshao.setText("班级：16计科5\n学号：20160404430546");
        photo.setImageDrawable(getResources().getDrawable(R.drawable.one,null));

        ll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mark++;
                switch (mark) {
                    case 1:
                        name.setText("詹炳武");
                        jieshao.setText("班级：16计科5\n学号：20160404430546");
                        photo.setImageDrawable(getResources().getDrawable(R.drawable.one,null));
                        break;
                    case 2:
                        name.setText("黎镕彬");
                        jieshao.setText("班级：16计科5\n学号：20160404430519");
                        photo.setImageDrawable(getResources().getDrawable(R.drawable.two,null));
                        break;
                    case 3:
                        name.setText("李铭聪");
                        jieshao.setText("班级：16计科5\n学号：20160404430521");
                        photo.setImageDrawable(getResources().getDrawable(R.drawable.three,null));
                        mark = 0;
                        break;
                }
            }
        });
    }
}
